package com.wanmait.wisdom.manage.controller;


import com.wanmait.wisdom.entity.Building;
import com.wanmait.wisdom.manage.service.ManageBuildingService;
import com.wanmait.wisdom.util.AjaxResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("manage")
public class MangeBuildingController {


    @Resource
    private ManageBuildingService buildingService;

    /**
     * 楼栋分页列表
     * @param pageNum
     * @param pageSize
     * @return
     */
    @GetMapping("buildingPageList")
    public AjaxResult buildingPageList(Integer pageNum,Integer pageSize){return buildingService.listPage(pageNum,pageSize);
    }
    @RequestMapping("buildingsave")
    public AjaxResult save(@RequestBody Building building){return buildingService.savebuilding(building);}
    @PostMapping("checkbuildingname")
    public AjaxResult checkName(@RequestBody Building building){return buildingService.checkName(building);}
    @GetMapping("findbuilding")
    public AjaxResult findBuilding(){return buildingService.findBuilding();}
    @GetMapping("findBuildingNumberOptions")
    public AjaxResult FindBuildingNumberOptions(){
        return buildingService.FindBuildingNumberOptions();
    }

    @GetMapping("selectAllBuilding")
    public AjaxResult selectAllBuilding(){return AjaxResult.success(buildingService.list());}

    @GetMapping("getBuildingCount")
    public AjaxResult getBuildingCount(){return AjaxResult.success(buildingService.getBuildingCount());}

}
